<!--
 * @Description: 
 * @Author: 赵华宇
 * @Date: 2025-04-27 15:25:22
 * @LastEditors: 赵华宇
 * @LastEditTime: 2025-04-27 15:29:29
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>属性</title>
    <style>
        .father {
            width: 500px;
            height: 300px;
            margin: 100px auto;
            border:1px solid black;

        }
        .son {
            width: 200px;
            height: 100px;
            background-color: pink;
            transition: all 0.5s;
        }
        /* 鼠标移动到父盒子 son盒子改变位置 */
        .father:hover .son {
            transform:  translate(100px, 50px);
            /* 取值百分比 参照盒子自身尺寸计算结果*/
            transform: translate(50%, 50%);
            /* 只写一个数表示水平方向 */
            transform: translate(300px);
        }
        .box{
            position: absolute;
            left:50%;
            top:50%;
            /* 向左向上移动自身尺寸的一半 */
            transform: translate(-50%, -50%);
            width: 200px;
            height: 100px;
            background-color: pink;

        }
    </style>
</head>
<body>
    <div class="father">
        <div class="son"></div>
    </div>
    <div class="box"></div>
</body>
</html>